/*
* ======================================================================
* ----------------------------------------------------------------------
* zOEcontent:      zon Outer Extra Content
* Author:          zon - http://inimu.com
* Script Homepage: http://inimu.com/widget/zoecontent/
* ----------------------------------------------------------------------
* You may use the codes below and its associated files
* as long as you leave the author credit remain intact
* ----------------------------------------------------------------------
* ======================================================================
*/

/* required variables */
/*
var zoec_MainContentWidth = 1024;
*/

if (typeof zoec_MainContentWidth != 'undefined') {
	try {
		var zoec_MainContentWidth2x = zoec_MainContentWidth*2;
		} catch (err) {
		var zoec_MainContentWidth = 1024;
	}
	} else {
	var zoec_MainContentWidth = 1024;
}

/* general variables */
var zlt = unescape('%3C');
var zgt = unescape('%3E');
var zHead = document.getElementsByTagName('head')[0];
var zBody = document.getElementsByTagName('body')[0];

/* css insertion */
function zSetStyleTextDo(zStyleTextContent,zStyleTextId,zStyleTextMedia) {
	var zStyleTextNode = document.createElement('style');
	zStyleTextNode.type = 'text/css';
	zStyleTextNode.media = zStyleTextMedia;
	zStyleTextNode.setAttribute('id',zStyleTextId);
	if (!!(window.attachEvent && !window.opera)) {
		zStyleTextNode.styleSheet.cssText = zStyleTextContent;
	} else {
		var zStyleTextContentText = document.createTextNode(zStyleTextContent);
		zStyleTextNode.appendChild(zStyleTextContentText);
	}
	zHead.appendChild(zStyleTextNode);
}
function zSetStyleLinkDo(zStyleLinkUrl,zStyleLinkId,zStyleLinkMedia) {
	var zStyleLinkNode = document.createElement('link');
	zStyleLinkNode.type = 'text/css';
	zStyleLinkNode.rel = 'stylesheet';
	zStyleLinkNode.href = zStyleLinkUrl;
	zStyleLinkNode.media = zStyleLinkMedia;
	zStyleLinkNode.setAttribute('id',zStyleLinkId);
	zHead.appendChild(zStyleLinkNode);
}

/* set style */
var zStyleTextZoec1 = ''
 +'#zoec, #zoecbg, #zoecleft, #zoecright, #zoeccred1, #zoeccred2 { overflow:hidden; }'
 +'#zoeccred1, #zoeccred2 { z-index:100; position:fixed; top:0; bottom:0; margin:auto 0; width:14px; height:30px; font-size:30px; line-height:30px; font-weight:bold; font-family:Arial,sans-serif; text-decoration:none; text-align:center; opacity:0.40; filter:alpha(opacity=40); background-color:#000; color:#fff; }'
 +'#zoeccred1:hover, #zoeccred2:hover { opacity:1.00; filter:alpha(opacity=100); text-decoration:none; }'
 +'#zoeccred1 { left:0; padding:6px 2px 6px 0; border-radius:0 8px 8px 0; -moz-border-radius:0 8px 8px 0; }'
 +'#zoeccred2 { right:0; padding:6px 0 6px 2px; border-radius:8px 0 0 8px; -moz-border-radius:8px 0 0 8px; }'
 +'#zoeccred1 { display:none; }'
 +'#zoecbg { position:fixed; z-index:-10; top:0; right:0; bottom:0; left:0; }'
 +'#zoecleft, #zoecright { position:fixed; top:0; bottom:0; }'
 +'#zoecleft { left:0; }'
 +'#zoecright { right:0; }'
 +'';
zSetStyleTextDo(zStyleTextZoec1,'zStyleTextZoec1Id','screen');

var zoecAvailW = 630;
var zoecMaxSideWidth = ((screen.width-25)-zoec_MainContentWidth)/2;
var zoecSideWidth = 0;
var zoecAvailSideWidth = 0;
var zoecSideMove = 0;

var zoecNode = document.getElementById('zoec');
var zoecBgNode = document.getElementById('zoecbg');
var zoecLeftNode = document.getElementById('zoecleft');
var zoecRightNode = document.getElementById('zoecright');

if (zoecNode.getElementsByTagName('a')[0]) {
 var zoecFakeCred = zoecNode.getElementsByTagName('a')[0];
 if (zoecFakeCred.style.display) {
  zoecFakeCred.style.display = 'none !important';
 }
 zoecFakeCred.innerHTML = '';
 zoecNode.removeChild(zoecFakeCred);
}
document.write(zlt+'a id="zoeccred1" title="Outer Extra Content Widget" href="http://inimu.com/widget/zoecontent/" target="_blank"'+zgt+'i'+zlt+'/a'+zgt);
document.write(zlt+'a id="zoeccred2" title="Outer Extra Content Widget" href="http://inimu.com/widget/zoecontent/" target="_blank"'+zgt+'i'+zlt+'/a'+zgt);

function zoecSetPositionDo() {
 if (document.body && document.body.offsetWidth) { zoecAvailW = document.body.offsetWidth-25; }
 if (document.compatMode=='CSS1Compat' && document.documentElement && document.documentElement.offsetWidth ) { zoecAvailW =  document.documentElement.offsetWidth-25; }
 if (window.innerWidth && window.innerHeight) { zoecAvailW = window.innerWidth-25; }
 zoecAvailSideWidth = (zoecAvailW-zoec_MainContentWidth)/2;
 zoecSideMove = zoecAvailSideWidth-zoecMaxSideWidth;
 zoecLeftNode.style.width = zoecMaxSideWidth.toString()+'px' ;
 zoecLeftNode.style.marginLeft = zoecSideMove.toString()+'px' ;
 zoecRightNode.style.width = zoecMaxSideWidth.toString()+'px' ;
 zoecRightNode.style.marginRight = zoecSideMove.toString()+'px' ;
 try {
  var zoeccredWidth = 15;
  var zoeccred1Node = document.getElementById('zoeccred1');
  var zoeccred2Node = document.getElementById('zoeccred2');
  if (zoecAvailSideWidth < zoeccredWidth) {
   var zoeccredMove = zoecAvailSideWidth-zoeccredWidth;
   zoeccred1Node.style.marginLeft = zoeccredMove.toString()+'px';
   zoeccred2Node.style.marginRight = zoeccredMove.toString()+'px';
  } else {
   zoeccred1Node.style.marginLeft = '0px';
   zoeccred2Node.style.marginRight = '0px';
  }
  } catch (zerr) {
 }
}

zoecSetPositionDo();

if (window.captureEvents) { window.captureEvents(Event.RESIZE); }
window.onresize = zoecSetPositionDo;

document.getElementById('zoec').style.position='static';
